package yt.demo.appcorequartz.impl;

import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import yt.demo.appcommondb.base.BaseService;
import yt.demo.appcommondb.vo.ConditionVO;
import yt.demo.appcorequartz.entity.QuartzLog;
import yt.demo.appcorequartz.mapper.QuartzLogMapper;
import yt.demo.appcorequartz.service.IQuartzLogService;
import java.util.ArrayList;
import java.util.List;

@Slf4j
@Service
public class QuartzLogService extends BaseService<QuartzLog, QuartzLogMapper> implements IQuartzLogService {

    @Autowired
    public QuartzLogService(QuartzLogMapper mapper) {
        super(mapper, QuartzLog.class);
    }

    @Override
    protected List<ConditionVO<QuartzLog, ?>> whereConditions(QuartzLog params) {
        List<ConditionVO<QuartzLog, ?>> conditions = new ArrayList<>();
        if (ObjectUtil.isNotEmpty(params.getJobId())) {
            conditions.add(ConditionVO.createCondition(QuartzLog::getJobId, "eq", params.getJobId()));
        }
        return conditions;
    }

}
